package com.zhijian.medical.controller;

import com.zhijian.medical.entity.po.RoutineSampleTemplate;
import com.zhijian.medical.entity.vo.request.*;
import com.zhijian.medical.entity.vo.response.RoutinePatientVo;
import com.zhijian.medical.enums.PatientEnums;
import com.zhijian.medical.enums.RoutinePathologySampleStepEnum;
import com.zhijian.medical.service.RoutinePatientService;
import com.zhijian.medical.service.RoutineSampleTemplateService;
import com.zhijian.response.annotation.Response;
import com.zhijian.util.page.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 设置样本 控制层
 *
 * @author auto
 * @version 1.0
 * @date 2024-06-26 15:42:40
 */
@Slf4j
@Controller
@Api(tags = "设置样本-病人")
public class RoutinePatientTemplateController {

    @Autowired
    private RoutineSampleTemplateService service;

    /**
     * 查询样本列表
     *
     * @param routineSampleTemplateSearchVo
     * @return
     */
    @Response
    @PostMapping("/routine/sample/template/page")
    @ApiOperation("分特查询样本列表")
    public Page<RoutineSampleTemplate> offBody(@RequestBody RoutineSampleTemplateSearchVo routineSampleTemplateSearchVo) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), routineSampleTemplateSearchVo);
        return service.selectPage(routineSampleTemplateSearchVo);
    }

    /**
     * 查询样本列表
     *
     * @param routineSampleTemplateSearchVo
     * @return
     */
    @Response
    @PostMapping("/routine/sample/template/list")
    @ApiOperation("查询样本列表")
    public List<RoutineSampleTemplate> offBodyList(@RequestBody RoutineSampleTemplateSearchVo routineSampleTemplateSearchVo) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), routineSampleTemplateSearchVo);
        return service.selectList(routineSampleTemplateSearchVo);
    }

    /**
     * 新增样本模版
     *
     * @param routineSampleTemplate
     * @return
     */
    @Response
    @PostMapping("/routine/sample/template")
    @ApiOperation("新增样本模版列表")
    public RoutineSampleTemplate fixed(@RequestBody RoutineSampleTemplate routineSampleTemplate) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), routineSampleTemplate);
        return service.addTemplate(routineSampleTemplate);
    }

    /**
     * 修改样本模版
     *
     * @param routineSampleTemplate
     * @return
     */
    @Response
    @PutMapping("/routine/sample/template/{id}")
    @ApiOperation("修改样本模版列表")
    public RoutineSampleTemplate updateTemplate(@PathVariable("id") Long id, @RequestBody RoutineSampleTemplate routineSampleTemplate) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), routineSampleTemplate);
        routineSampleTemplate.setId(id);
        return service.updateTemplate(routineSampleTemplate);
    }

    @Response
    @DeleteMapping("/routine/sample/template/{id}")
    @ApiOperation("删除样本模版列表")
    public void deleteTemplate(@PathVariable("id") Long id){
        service.deleteTemplate(id);
    }

}